package com.tiancheng.trade.payment.enums;

import com.tiancheng.trade.commom.core.enums.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * paypal支付方式
 */
@Getter
@AllArgsConstructor
public enum PaypalMethodEnum implements BaseEnum<String> {

    CARD("credit_card", "销售"),
    PAYPAL("paypal", "授权"),
    ;


    private String code;
    private String desc;

    public static String getDesc(String code) {
        Optional<PaypalMethodEnum> found = Arrays.stream(PaypalMethodEnum.values()).filter(c -> c.code.equals(code)).findFirst();
        if (found.isPresent()) {
            return found.get().getDesc();
        }
        return "";
    }
}

